﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace BattleMaster_IRCbot.UserCommands
{
    class MakeCharacter : Command
    {
        public override string Name { get { return _name; } }
        public override string[] Aliasses { get { return _aliasses; } }
        public override string Description { get { return _description; } }
        public override string ShortDesc { get { return _shortDesc; } }

        public MakeCharacter()
        {
            _name = "MakeCharacter";
            _aliasses = new string[] { "makechar" };
            _description = "Use this command to create your character.\n The character will be associated with your nick and cannot be accessed usin a different nick.";
            _shortDesc = "Use this command to create your character.";
        }

        public override void Verb(Game game, string msgOrigen, string[] cmd)
        {
            if (msgOrigen == "console")
            {
                try
                {
                    game.CreateCharacter(cmd[1]);
                    System.Console.WriteLine(String.Format("Character \"{0}\" created.", cmd[1]));
                }
                catch (FileLoadException ex) { System.Console.WriteLine(ex.Message); }
            }
            else
            {
                try
                {
                    game.CreateCharacter(msgOrigen);
                    game.ircHandler.sendNotice(msgOrigen, String.Format("Character \"{0}\" created.", msgOrigen));
                }
                catch (Exception ex) { game.ircHandler.sendNotice(msgOrigen, ex.Message); }
            }
        }
    }
}
